﻿using Bigger.Demo.DbModels;
using Bigger.Demo.DbProviders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bigger.Demo.Businesses.Implements
{
    public class ProductBiz : IProductBiz
    {
        private IProductProvider productProvider;
        public ProductBiz(IProductProvider productProvider)
        {
            this.productProvider = productProvider;
        }

        /// <summary>
        /// 获取商品列表
        /// </summary>
        /// <returns></returns>
        public IList<PruductModel> GetList()
        {
            return productProvider.GetList();
        }
        /// <summary>
        /// 分页获取商品列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IList<PruductModel> GetPageList(int pageIndex, int pageSize)
        {
            return productProvider.GetPageList(pageIndex, pageSize);
        }
        /// <summary>
        /// 分页获取商品列表并获取总数
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public IList<PruductModel> GetPageList(int pageIndex, int pageSize, out long recordCount)
        {
            return productProvider.GetPageList(pageIndex, pageSize, out recordCount);
        }
        /// <summary>
        /// 根据商品编号获取商品
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        public PruductModel GetItem(int productId)
        {
            return productProvider.GetItem(productId);
        }
        /// <summary>
        /// 获取商品总数
        /// </summary>
        /// <returns></returns>
        public long Count()
        {
            return productProvider.Count();
        }
    }
}
